from sub_strategy import SubStrategy
# 定义搜索子任务

@SubStrategy.register(strategy_type='search')
class SearchStrategy(SubStrategy):

    def GetState(self, origindata):
        # 处理原始数据，提取状态信息
        state = []
        return state
    
    def GetAction(self, action, originaldata = None, use_current_action=True):
        if not use_current_action:
            state = self.GetState(origindata=originaldata) 
            action = self.current_policy.predict(state,determine=True)  # 使用当前策略预测动作

        # 将action转换为原始范围的指控命令
        angle = action[0] * 180  # 假设action[0]是角度
        speed = action[1] * 1000 
        high = action[2] * 10000
        fire = action[3] > 0.5  # 假设action[3]是火控开关
        radar = action[4] > 0.5
        pass
    def Reset(self):
        pass
    def GetTerminate(self,origindata):
        # 检查子任务是否终止
        return False